import { getcookie } from './cookie'

const roles = getcookie() as string || 'editor'

let asynclist:any[] = []

const Navigation = [
    { name: "大屏管理", list: [{ listname: "打榜榜单", path: "/home" }],roles:['admin','editor'] },
    { name: "订单管理", list: [{ listname: "订单列表", path: "/home/shoplist" }],roles:['admin','editor'] },
    { name: "数据统计", list: [{ listname: "数据汇总", path: "/censuslist" }],roles:['admin'] },
    { name: "系统设置", list: [{ listname: "系统配置", path: "/systemlist" }],roles:['admin','editor'] }
]
console.log("拿到了所有的导航栏")

// 根据登陆身份生成对应的左侧导航栏
const asyncNavigation = (val: any[]) =>{
    val.forEach(v=>{
        if(v.roles.includes(roles)){
            asynclist.push(v)
        }
    })
    return asynclist
}

asynclist = asyncNavigation(Navigation);

export default asynclist